<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link rel="stylesheet" type="text/css" href="/session/css/common.css"/>
    <script type="text/javascript" src="/plan/js/jquery.1.9.1.js" ></script>
     <script type="text/javascript" src="/plan/js/layer.js" ></script>
	<script type="text/javascript" src="js/mobileSelect.js"></script>
	<link rel="stylesheet" type="text/css" href="css/mobileSelect.css"/>
	<script type="text/javascript" src="js/rolldate.min.js" ></script>
	<script type="text/javascript" src="js/rem.js" ></script>
    <title>场次信息</title>
</head>
<body>
	<ul class="order_money" style="padding: 0 0.3rem;background: #fff;margin-bottom: 1.5rem;">
		<li style="position: relative;height: 1.1rem;">
	    		<span class="time">开会时间</span>
	    		<span class="jt"></span>
	    		<span class="bitian">必填</span>
	    		<input readonly class="form-control" type="text" id="date-group1-4">
	    </li>
	    <li>
			<span class="type">学校类别</span><span class="jt"></span>
			<div id="trigger1" class="trigger1" style="display: inline-block;width: 96%;margin-top: 0.1rem;">
			 	<span class="bitian1">必填</span>
			</div>
			<input type="hidden" name="" id="type" value="" />								
		</li>
		<li>
			<span class="addr">会议地点</span><span class="jt"></span>
			<div id="trigger2" class="trigger2" style="display: inline-block;width: 96%;margin-top: 0.1rem;">
			 	<span class="bitian1">必填</span>
			</div>
			 <input type="hidden" name="" id="intention" value="" />								
		</li>
	    <li>
	    		<span class="fontchang">详细地址</span>
	    		<span class="must">必填</span>
	    		<input type="text" name="" id="address" value="" />
	    </li>
	    <li>
	    		<span class="fontchang">赠书数量</span>
	    		<span class="must">必填</span>
	    		<input type="number" pattern="[0-9]*" name="" id="znum" value="" />
	    </li>
	    <li>
	    		<span class="fontchang">讲师</span>
	    		<div class="choose">
				<div>
					<img src="http://b-ssl.duitang.com/uploads/item/201704/10/20170410073535_HXVfJ.thumb.700_0.jpeg" />
					<img class="close" src="img/close.png" />
					<p>讲师</p>
					<input type="hidden" value="" id="userid" />
				</div>
				<div>
					<img style="display: none;" src="img/addwl.png" />
				</div>
			</div>
	    </li>
	    <li>
	    		<span class="fontchang">备注</span>
	    		<textarea id="beizhu" value=""></textarea>
	    </li>
	</ul>
	<div class="preserve">保存</div>
</body>
<script>
$(function(){
	$('.close').click(function(){
		$(this).parent().hide();
		$(this).parent().siblings().css('margin-left','0');
		$(this).parent().siblings().children().show();
	});
	//提交表单
	$('.preserve').click(function(){
		var datetime = $('#date-group1-4').val();
		var type = $('#type').val();
		var intention = $('#intention').val();
		var address = $('#address').val();
		var znum = $('#znum').val();
		var lecturer = $('#userid').val();
		var beizhu = $('#beizhu').val();
		if(datetime == ''||datetime == null){
				layer.open({
				content:'请选择开会时间' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		if(type == ''||type == null){
				layer.open({
				content:'请选择学校类别' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		if(intention == ''||intention == null){
				layer.open({
				content:'请选择开会地点' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		if(address == ''||address == null){
			layer.open({
				content:'请填写详细地址' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		if(znum == ''||znum == null){
			layer.open({
				content:'请填写赠书数量' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		if(lecturer == ''||lecturer == null){
				layer.open({
				content:'请选择讲师' ,
				skin: 'msg',
				time: 2 //2秒后自动关闭
			});
			return false
		}
		$.ajax({
		  type: 'post',
		  url:"" ,
		  data:{datetime:datetime,type:type,intention:intention,address:address,znum:znum,lecturer:lecturer,beizhu:beizhu},
		  dataType: "json",
		  success: function(data){
		    window.location.href = "index.html";
		  }
		});
	 });
	 //字体变化
	$('input').keyup(function(){
		if($(this).val() != ''){
			$(this).siblings('.must').hide();
			$(this).siblings('.fontchang').css('font-size','0.2rem');
		}else{
			$(this).siblings('.must').show();
			$(this).siblings('.fontchang').css('font-size','0.32rem');
		}
	});
	if($('#userid').val() != ''){
		$('#userid').parents('.choose').siblings('.fontchang').css('font-size','0.2rem');
	}else{
		$('#userid').parents('.choose').siblings('.fontchang').css('font-size','0.32rem');
	}
	$('textarea').keyup(function(){
		if($(this).val() != ''){
			$(this).siblings('.must').hide();
			$(this).siblings('.fontchang').css('font-size','0.2rem');
		}else{
			$(this).siblings('.must').show();
			$(this).siblings('.fontchang').css('font-size','0.32rem');
		}
	});
	//日期
	new Rolldate({
		el: '#date-group1-4',
		format: 'YYYY-MM-DD hh:mm',
		beginYear: 2000,
		endYear: 2100,
		confirm: function(date) {
			$('.bitian').hide();
			$('.time').css('font-size','0.2rem');
		},
		cancel: function() {
			console.log('取消');
		}
	})
	//选择
	var mobileSelect1 = new MobileSelect({
	    trigger: '#trigger1',
	    title: '会议类型',
	    wheels: [{data:[
	    					{
	                        id:'1',
	                        value:'中考'
	                    },
	                    {
	                        id:'2',
	                        value:'高考'
	                    }
	    			]}],
		 callback:function(indexArr, data){
		    $('#type').val(data[0].value);
		    $('.type').css('font-size','0.2rem');
		 }  
	});
	var mobileSelect2 = new MobileSelect({
	    trigger: '#trigger2',
	    title: '地区选择',
	    wheels: [{data:[
	    					{
	                        id:'1',
	                        value:'',
	                        childs:[
	                            {id:'A1',value:''},
	                        ]
	                    }
	    			]}],
		 callback:function(indexArr, data){
		 	console.log(data);
		    $('#intention').val(data[1].value);
		    $('.addr').css('font-size','0.2rem');
		 }  
	});
	 $.ajax({
	    type: "post",
	    url: "https://oa.fc62.com/api/ajax/area",
	    dataType: "json",
	    success: function(res){
	    	console.log(res.data);
	        mobileSelect2.updateWheels(res.data);
	    }
	});
});
</script>
</html>
